Information traffic in computer networks may comprise data packets. Often, packets may be characterized as belonging to this or that particular “flow”; a flow of packets is a sequence or group of packets that are in some way related. For example, they may be associated with the same sender and receiver. Traffic passing through a network device such as a bridge or router may comprise a plurality of distinct packet flows.
A network device may comprise network processors that execute network-processing software. A network processor may include a plurality of processing elements or units capable of processing packets in parallel, which helps to increase traffic throughput. There exist a number of different implementations of network software that uses multiple processing elements to perform packet processing in parallel. However, some implementations of the network software may be less efficient than others. For example, some implementations are hampered by contention for shared resources, such as shared memory and data structures, and the need for time-consuming accesses to shared resources.
More efficient implementations are known which, for example, take advantage of observed tendencies in packet processing behavior. More specifically, the more efficient software may exploit a phenomenon referred to herein as “packet flow data locality.” Packet flow data locality is a term that refers to a tendency for the processing of packets from the same flow to access the same area of memory, while the processing of packets from another, different flow accesses a different, disjoint area of memory. Using packet flow data locality, it is possible to, for example, reduce contention for shared resources, and to realize other efficiencies described in more detail further on.
However, coding software to exploit packet flow data locality typically requires detailed knowledge of a particular processor architecture and of packet flow behavior. Accordingly, typical implementations of network software may be unduly inefficient in at least the aspect of parallel packet processing because of the expense or effort and programming skill required to code more efficient implementations. Thus, it would be useful and improve network software in general to reduce the effort of coding software that takes advantage of packet flow data locality in parallel processing of multiple packet flows.